package cn.edu.zut.mapper;

import cn.edu.zut.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Davey chan
 */
public interface UserMapper {
//    用户登录的接口代码，采用注解省去了XML里面SQL代码的书写
    @Select("select *from tb_user where username=#{username} and password=#{password}")
    User select(@Param("username") String username, @Param("password") String password);
/*注册页面的实现
* 1，实现用户名查询的判断
* 2，将用户名和密码加入数据库中*/
    @Select("select * from tb_user where username=#{username}")
    User selectByusername(String username);
    @Insert("insert into tb_user values(null,#{username},#{password})")
   void  add(User user);

}
